#! /usr/bin/python
#
# Created By: Kevin T. Ryan
# Created On: 2007-Mar-04 @ 7:37:12 PM
# Email:      kevin.t.ryan@gmail.com
# License:    BSD (http://www.opensource.org/licenses/bsd-license.php)
#

# Demo's our graphn module

import graphn
import colors

# Create a graph of 400px x 300x, with the line color set to a
# nice blue
g = graphn.LineGraph(width=500, height=300, title="My 1st Graph",
        xlabel="Month", ylabel="Percents are fun")
# g.set_prop("color", colors.indianred)

# Add some data points to our graph
# g.add_x_data([10, 20, 30, 40, 50, 60])
# g.add_y_data([100, 200, 300, 400, 500, 600])

# A more expansive example
# g.add_x_data([19558880, 24938920, 71491012, 102844710, 257326791, 363394987])
# g.add_y_data([1439546228, 1686711596, 2586676112, 8907875172, 3778427370, 4260966724])

# Try it with some random numbers ... we'll use 3 datasets to
# show how the "colorpalette" option works
g.add_x_data([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
g.add_y_data([13.4, 51.9, 37.7, 30.3, 24.2, 25.1, 29.7, 33.9, 35.3, 24.2, 26.3, 41.4])

# g.add_x_data([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
# g.add_y_data([21.7, 25.4, 26.9, 0.7, 37.4, 6, 4, 37.3, 11, 12, 21.9, 25.1])

g.add_x_data([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
g.add_y_data([16.9, 12.4, 8, 10.2, 49.1, 22.1, 15.9, 47.3, 15.5, 34.6, 24.8, 1.7])

# Draw the graph and save it to a file
g.render(fn="testinggraph.png")
